package com.cn.lp.converter.demo.converter;


import com.cn.lp.converter.BeanConverter;
import com.cn.lp.converter.MergeResult;
import com.cn.lp.converter.annotation.CheckFieldSetting;
import com.cn.lp.converter.annotation.ConverterMapper;
import com.cn.lp.converter.annotation.FieldNameFilter;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@ConverterMapper
@CheckFieldSetting
public interface TestBeanConverter extends BeanConverter<TestBeanConverter.EntityA, TestBeanConverter.EntityB> {

    @Data
    class EntityA {

        private HashMap<String, Integer> mapData;

        private int age;

    }

    @Data
    class EntityB {

        private Map<String, Integer> mapData;

        private long age;

    }

    @Override
    @CheckFieldSetting(fieldNameFilter = @FieldNameFilter(assignIgnoreFieldName = "age"))
    MergeResult<EntityB> mergeTo(EntityA source, EntityB target);

    @Override
    @CheckFieldSetting(fieldNameFilter = @FieldNameFilter(assignIgnoreFieldName = "age"))
    EntityB convertTo(EntityA source);

}
